<template>
	<view class="containers">
		<scroll-view 
		          :scroll-top="scrollTop"
		          scroll-y="true"
		          class="scroll-Y"
				  style="height:90vh;"  @scrolltoupper="upper" @scrolltolower="lower"
		 @scroll="scroll">
			<view class="center u-m-t-30">
				<view class="form">
					<view class="list u-m-t-30  u-p-b-20 u-border-bottom u-flex u-row-between">
						<text class="zhaopintwo u-m-r-50">项目名称</text>
						<text class="zhaopintwo">{{model.projectName}}</text>
					</view>
					<!-- <view class="list u-m-t-30 u-p-b-20 u-border-bottom u-flex u-row-between">
						<text class="zhaopintwo u-m-r-50">项目地点</text>
						<text class="zhaopintwo">{{model.address}}</text>
					</view>
					<view class="list u-m-t-30 u-p-b-20 u-flex u-row-between">
						<text class="zhaopintwo u-m-r-50">项目规模</text>
						<text class="zhaopintwo">{{model.scale}}</text>
					</view> -->
				</view>
				<view class="form" v-for="(item,index) in model.list" :key="index">
					<view class="u-flex u-row-center myview" v-if="index === 0">
						我的观点
					</view>
					<view class="u-flex u-row-center myview" v-else>
						伙伴观点
					</view>
					<view v-if="index === 0" class="u-flex u-row-center star u-m-t-20 u-p-b-20 u-border-bottom">
						<u-rate v-model="item.score" :count="count" :active-color="activeColor" :inaction-color="inactiveColor" :size="50" :disabled="disabled"></u-rate>
					</view>
					<view v-else class="u-flex u-row-center star u-m-t-20 u-p-b-20 u-border-bottom">
						<u-rate v-model="item.score" :count="count" :active-color="activeColor1" :inaction-color="inactiveColor1" :size="50" :disabled="disabled"></u-rate>
					</view>
					<view class="u-m-t-20">
						{{item.comment}}
					</view>
					<view class="u-m-t-20 u-flex u-row-between zhihui">
						<view class="riqi">{{item.createTime}}</view>
						<view class="zhaopintwo">
							{{item.amount}}
							<image src="../../static/img/zhixiao.png" class="u-m-l-15"></image>
						</view>
					</view>
				</view>
				
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		name: "m-viewpoint-detail",
		props: {
			datas: Object, //数据
		},
		data() {
			let that = this;
			return {
				fileList: [],
				showUploadList: true,
				customBtn: false,
				autoUpload: true,
				showProgress: false,
				deletable: true,
				customStyle: false,
				maxCount: 9,
				lists: [], // 组件内部的文件列表
				filePaths:'', // 文件路径
				fileNames:'', // 文件名称
				action:this.$apis.uploadFile,
				baseUrl:this.$mConfig.baseUrl,
				activeColor: '#FF9900',
				inactiveColor: '#FFE2CF',
				activeColor1:'#4B9CFF',
				inactiveColor1: '#4B9CFF',
				disabled: true,
				count: 5,
				customIcon: false,
				plain: false,
				value: 4,
				active: true,
				model: {
					"businessId": '',
					"comment": "",
					"createTime": "",
					"images": [],
					"otherRemark": "",
					"report": "",
					"rewardAmount": '',
					"score": 5,
					"type": 0,
				},
				rules: [],
				errorType: ['toast'],
				listReport: ['欺诈', '虚假', '工程问题', '其他'],
				showReport: false,
				border: false,
				labelPosition: 'left',
				scrollTop: 0,
				old: {
					scrollTop: 0
				},
				followLogo: this.$mAssetsPath.followLogo,
				bgColor: this.$u.color.bgColor,
				marginTop: 30,
				marginBottom: 30,
			};
		},
		mounted() {},
		onShow() {},
		onReady() {
			this.$refs.uForm.setRules(this.rules);
		},
		created: function() {
			var that = this;
			let list = that.datas;
			console.log(list);
			this.model = list;
		},
		methods: {
			onUploaded(lists) {
				 var filePaths = [],fileNames = [];
				 for(let i in lists){
				 	console.log('data',lists[i].response);
				 	if(lists[i].response.code == 200){
				 		filePaths.push(lists[i].response.message);
				 	}
				 }		
				 //this.filePaths = filePaths.join(',');
				 this.model.images = filePaths;
			},
			handleClickCheck(e) {
				this.active = e
			},
			confirm(e) {
				var itemKey = e[0];
				this.model.report = this.listReport[itemKey];
			},
			onClick() {
				this.$emit('click', {
					model: this.model
				})
			}
		}

	}
</script>

<style scoped lang="scss">
	page,.containers {
		background: #f4f4f4;
		height: 100%;
	}
	
	.riqi {
		padding: 4rpx;
	
		color: #4B9CFF;
		// opacity: 0.1;
		border-radius: 6rpx;
		background: #b9cce2;
	}
	
	.zhihui image {
		width: 27rpx;
		height: 27rpx;
	}
	
	.myview {
	
		color: #0D1D36;
		font-size: 36rpx;
	}
	
	.star image {
		width: 48rpx;
		height: 48rpx;
		margin-right: 30rpx;
	
	}
	
	.container {
		position: relative;
	
		.top {
			position: absolute;
			top: 0;
			width: 100%;
			height: 370upx;
		}
	
		.qiye {
			position: relative;
		}
	
		.center {
			width: 690rpx;
			z-index: 1;
			margin-left: 30rpx;
			position: relative;
			overflow: hidden;
	
			.form {
				width: 100%;
				background-color: #fff;
				border-radius: 20rpx;
				padding: 32rpx 30rpx;
				margin-top: 57rpx;
	
				.zhaopin {
	
					font-size: 36rpx;
					color: #0E1E36;
				}
	
				.zhaopintwo {
					font-size: 28rpx;
	
					color: #888D99;
				}
			}
	
			.qiye {
				width: 100%;
				height: 90rpx;
				background: #FFFFFF;
				border-radius: 20rpx 20rpx 0px 0px;
	
				.list {
					.item {
						display: flex;
						align-items: center;
						padding: 0 24rpx;
						justify-content: space-between;
					}
				}
			}
		}
	}
</style>
